package com.xxx.dubbo.client.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.xxx.dubbo.user.api.UserService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * rpc client
 */
@RestController
public class UserController {

    // 使用dubbo的@Reference注解注入dobbo provider
    @Reference
    private UserService userService;

    @RequestMapping("/sayHello/{name}")
    public String hello(@PathVariable String name){
        System.out.println("enter method hello. name:"+name);
        return userService.hello(name);
    }

}
